package com.droidblackbox;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.CountDownTimer;

import com.droidblackbox.accident.AccidentMapView;
import com.droidblackbox.manager.C2DMManager;

public class DroidBlackBoxLogo extends Activity {
	/** Called when the activity is first created. */

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.logo);

		Intent intent = null;
		Intent getIntent = null;
		try {
			getIntent = getIntent();
			Bundle bundle = getIntent.getExtras();
			String string = bundle.getString(C2DMManager.EXTRA_KEY);
			intent = new Intent(DroidBlackBoxLogo.this, AccidentMapView.class);
			intent.putExtra(C2DMManager.EXTRA_KEY, string);

		} catch (NullPointerException e) {
			intent = new Intent(DroidBlackBoxLogo.this, DroidBlackBox.class);
		}
		onAppStart(intent);

	}

	private CountDownTimer appStart = null;

	protected void onAppStart(final Intent intent) {
		appStart = new CountDownTimer(1000, 1000) {

			@Override
			public void onFinish() {
				startActivity(intent);
				cancel();
				finish();

			}

			@Override
			public void onTick(long arg0) {
			}
		};

		appStart.start();

	}
}